package TestDemo4;

public class OutClass {
    public int demo1 = 1;
    public int demo2 = 2;
    public static int demo3 = 3;
    public void func(){
        System.out.println("OutClass:: func()");
        System.out.println(demo1);
        System.out.println(demo2);
    }

    public static class InnerClass {
        public int demo4 = 4;
        public static int demo5 = 5;
        public void func(OutClass outClass){
            System.out.println("InnerClass::func()");
            //外部类的非静态类可以创建外部类对象或传参来引用
            System.out.println(outClass.demo1);
            System.out.println(outClass.demo2);
            //外部类的静态类可以直接被内部类引用
            System.out.println(demo3);
            System.out.println(demo4);
            System.out.println(demo5);
        }
    }
}
